/*
 * @Author: Nxf
 * @Date: 2024-06-13 11:47:53
 * @LastEditors: Nxf
 * @LastEditTime: 2024-06-13 11:51:36
 * @Descripttion:
 */
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  base: './', // 打包部署后, 查找静态文件用相对路径
  // 配置代理, 开发时解决跨域.
  server: {
    open: true,
    port: 8888,
    // host: true,
    proxy: {
      // 注意 变量名 同 import.meta.env.VITE_BASE_API
      '/api': {
        target: 'http://114.55.25.205:8069/', // o17
        // target: 'http://101.42.18.73:8069/', // o17
        changeOrigin: true,
        rewrite: path => path.replace(/^\/api/, '')
      }
    }
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    }
  },
  //关闭ESLint（或其他 linting 工具）进行代码质量检查
  lintOnSave: false,
  define: {
    // enable hydration mismatch details in production build
    __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'true'
  }
})
